package com.vj.dao.impl;

import com.vj.dao.UserDao;
import com.vj.dao.ZhujieDao;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;

@Component("zhujieDao")
@Scope("singleton")//单例 默认单例,非单例:prototype
public class ZhujieDaoImpl implements ZhujieDao {
    @Value("${jdbc.username}")
    private String name;
    public ZhujieDaoImpl() {
        System.out.println("Jihe dao construct running");

    }

    public void talk() {
        System.out.println(" zhujie  dao talk:"+name);
    }
    @PostConstruct
    public void init() {
        System.out.println("Zhujie dao初始化");
    }
    @PreDestroy
    public void destory() {
        System.out.println("Zhujie dao销毁");
    }
}
